package com.scrum.Object;

import java.io.File;
import java.util.Date;

import javax.servlet.http.Part;

public class File_Process {

	private int maxFileSize = 50 * 1024;
	private int maxMemSize = 4 * 1024;
	private File file;

	public static String getFilename(Part part) {
		Date date = new Date();
		for (String cd : part.getHeader("content-disposition").split(";")) {
			if (cd.trim().startsWith("filename")) {
				String file_infor[] = cd.split("\\.");
				String filetail = file_infor[1].trim();
				System.out.println(filetail);
				String filename = file_infor[0].substring(cd.indexOf('=') + 1)
						.trim().concat(date.toString()).replace("\"", "").concat("."+file_infor[1])
						.replace("-", "").replace(" ", "").replace(":", "").replace("\"", "");
				return filename; // MSIE fix.
			}
		}
		return null;
	}
	

}
